package de.hsb.ai.agent.analyzer;

import java.util.List;

import org.jgrapht.Graph;
import org.jgrapht.GraphPath;
import org.jgrapht.graph.GraphPathImpl;

import de.hsb.ai.util.map.ScotlandJadeMapHelper.ScotlandJadeEdge;
import de.hsb.ai.util.map.ScotlandJadeMapHelper.ScotlandJadeVertex;

/**
 * ScotlandJadePath is a {@link GraphPath} that is price-performance aware. 
 */
public class ScotlandJadePath extends GraphPathImpl<ScotlandJadeVertex, ScotlandJadeEdge>
implements Comparable<ScotlandJadePath> {
       
        private final double endWeight;
        private final double pricePerformance;
 
        public ScotlandJadePath(
                        Graph<ScotlandJadeVertex, ScotlandJadeEdge> graph,
                        ScotlandJadeVertex startVertex, ScotlandJadeVertex endVertex,
                        List<ScotlandJadeEdge> edgeList, double pathWeight, double endWeight) {
                super(graph, startVertex, endVertex, edgeList, pathWeight);
                this.endWeight = endWeight;
                this.pricePerformance = pathWeight / endWeight;
        }
       
        public double getEndWeight() {
                return endWeight;
        }
       
        @Override
        public int compareTo(ScotlandJadePath o) {
                if (o.endWeight == endWeight) {
                        return o.getWeight() == getWeight() ? 0 : o.getWeight() < getWeight() ? -1 : 1;
                } else if (o.endWeight < endWeight) {
                        return -1;
                }
                return 1;
        }

		public double getPricePerformance() {
			return pricePerformance;
		}
       
}
